<template>
	<view class="page-e tn-safe-area-inset-bottom">
		<view class="top-backgroup" v-if="userInfo && userInfo.nickname">
			<image src="/static/img/mineBackgrand.png" mode='widthFix' class='backgroud-image'/>
		</view>
		<view class="tn-margin-left tn-margin-right margin-top" :style="{paddingTop: vuex_custom_bar_height + 'px'}">
			<!-- 图标logo/头像 -->
			<view class="tn-flex tn-flex-col-center tn-flex-row-center tn-margin-bottom" style="margin-top: -320rpx; position: relative;"
				v-if="userInfo && userInfo.nickname">
				<view class="justify-content-item tn-flex tn-flex-col-center tn-flex-row-center tn-margin-bottom" style="z-index: 999;">
					<view class="tn-flex tn-flex-direction-column tn-flex-col-center tn-flex-row-center">
						<view class="logo-pic tn-shadow" @click="goTo('/pages/mine/set')">
							<view class="logo-image">
								<!-- <view class="tn-shadow-blur" :style="'background-image:url(' + userInfo.avatar + ')'"
									style="width: 152rpx;height: 152rpx;background-size: cover;overflow: hidden;">
								</view> -->
								<image :src="userInfo.avatar" style="width: 152rpx;height: 152rpx;background-size: cover;overflow: hidden;"></image>
							</view>
						</view>
						<view class="tn-margin-top-sm tn-flex tn-flex-col-center tn-flex-row-center">
							<text
								class="tn-color-wallpaper tn-text-xl tn-text-bold">{{ userInfo.nickname }}
							</text>
						</view>
					</view>
				</view>
				<!-- 空白底板 -->
				<view class="about-shadow tn-padding-bottom-sm tn-bg-white backgroudmodel">
				</view>
			</view>

			<!-- 没有授权，则显示这个授权按钮-->
			<view class="tn-flex tn-flex-row-between" @click="login()" v-else>
				<view class="tn-flex-1 justify-content-item tn-margin-xs tn-text-center">
					<tn-button shape="round" backgroundColor="#1D2541" fontColor="#ffffff" padding="20rpx 0" width="40%"
						shadow>
						<text class="tn-icon-wechat tn-padding-right-xs tn-text-xl"></text>
						<text class="">授权登录</text>
					</tn-button>
				</view>
			</view>

			<!-- 更多信息-->
			<!-- <view class="about-shadow tn-margin-top-xl tn-padding-top-sm tn-padding-bottom-sm tn-bg-white"> -->
				<!-- 方式12 start-->
<!-- 				<view class="tn-flex tn-flex-row-center tn-radius tn-padding-top">
					<view class="tn-padding-sm tn-margin-xs tn-radius" @click="goTo('/pages/paper/grade')">
						<view class="tn-flex tn-flex-direction-column tn-flex-row-center tn-flex-col-center">
							<view
								class="icon12__item--icon tn-flex tn-flex-row-center tn-flex-col-center tn-bg-blue--light">
								<view class="tn-color-wallpaper tn-icon-order"></view>
							</view>
							<view class="tn-text-center" style="font-size: 28rpx;">
								<text class="tn-text-ellipsis">答题记录</text>
							</view>
						</view>
					</view>
					
					<block v-if="userInfo">
						<view class="tn-padding-sm tn-margin-xs tn-radius" @click="goTo('/pages/mine/set')">
							<view class="tn-flex tn-flex-direction-column tn-flex-row-center tn-flex-col-center">
								<view
									class="icon12__item--icon tn-flex tn-flex-row-center tn-flex-col-center tn-bg-blue--light">
									<view class="tn-color-wallpaper tn-icon-my"></view>
								</view>
								<view class="tn-text-center" style="font-size: 28rpx;">
									<text class="tn-text-ellipsis">个人设置</text>
								</view>
							</view>
						</view>
					</block>
				</view> -->
				<!-- 方式12 end-->
			<!-- </view> -->
			
			<!-- 更多信息 -->
			<view v-if="userInfo && userInfo.nickname" class="wallpaper-shadow tn-margin-top-lg tn-margin-bottom-lg tn-padding-top-sm tn-padding-bottom-sm">
				<tn-list-cell v-if="userInfo && userInfo.nickname" :hover="true" :unlined="true" :radius="true" :fontSize="30" @click="goTo('/pages/paper/grade')">
					<view class="tn-flex tn-flex-col-center">
						<view class="icon1__item--icon tn-flex tn-flex-row-center tn-flex-col-center"
							style="color: #7C8191;">
							<view class="tn-color-wallpaper tn-icon-order"></view>
						</view>
						<view class="tn-margin-left-sm tn-flex-1">答题记录</view>
						<view
							class="tn-margin-left-sm tn-color-wallpaper tn-text-sm tn-padding-left-xs tn-padding-right-xs tn-round">
							<text class="tn-icon-right"></text>
						</view>
					</view>
				</tn-list-cell>
				<tn-list-cell v-if="userInfo && userInfo.nickname" :hover="true" :unlined="true" :radius="true" :fontSize="30"  @click="goTo('/pages/mine/set')">
					<view class="tn-flex tn-flex-col-center">
						<view class="icon1__item--icon tn-flex tn-flex-row-center tn-flex-col-center"
							style="color: #7C8191;">
							<view class="tn-color-wallpaper tn-icon-my"></view>
						</view>
						<view class="tn-margin-left-sm tn-flex-1">个人设置</view>
						<view
							class="tn-margin-left-sm tn-color-wallpaper tn-text-sm tn-padding-left-xs tn-padding-right-xs tn-round">
						<text class="tn-icon-right"></text>
						</view>
					</view>
				</tn-list-cell>
				<tn-list-cell v-if="userInfo && userInfo.nickname" :hover="true" :unlined="true" :radius="true" :fontSize="30" @click="clearStorage()">
					<view class="tn-flex tn-flex-col-center">
						<view class="icon1__item--icon tn-flex tn-flex-row-center tn-flex-col-center"
							style="color: #7C8191;">
							<view class="tn-icon-logout"></view>
						</view>
						<view class="tn-margin-left-sm tn-flex-1">退出登录</view>
						<view
							class="tn-margin-left-sm tn-color-wallpaper tn-text-sm tn-padding-left-xs tn-padding-right-xs tn-round">
						<text class="tn-icon-right"></text>
						</view>
					</view>
				</tn-list-cell>
				
			</view>
		</view>

		<view class='tn-tabbar-height'></view>
		
	</view>
</template>

<script>
	export default {
		name: "kz-page-my-color",
		// emits: ['login', 'goTo', 'clearStorage'],
		props: {
			// 用户信息
			userInfo1: {
				type: Object,
				default: () => {}
			},
		},
		watch: {
			/**
			 * 监听user
			 * @param value
			 */
			userInfo1(value) {
				this.userInfo = value
			// 	// var page = uni.getStorageSync('page')
			// 	// this.showFollowBtn = parseInt(page.page_my_follow_mp_btn) == 1
			},
		},
		data() {
			return {
				show1: false,
				imgHost: this.imgUrl,
				// 关注公众号
				showFollowBtn: true,
				showFollow: false,
				followImage: '',
				userInfo:null
			}
		},
		methods: {
			login() {
				this.$emit('login')
			},
			goTo(page) {
				this.$emit('goTo', page)
			},
			clearStorage() {
				this.$emit('clearStorage')
			},
			clickFollow(){}
		}
	}
</script>

<style lang="scss" scoped>
	.page-e {
		max-height: 100vh;
	}

	/* 底部安全边距 start*/
	.tn-tabbar-height {
		min-height: 120rpx;
		height: calc(140rpx + env(safe-area-inset-bottom) / 2);
		height: calc(140rpx + constant(safe-area-inset-bottom));
	}

	.tn-color-wallpaper {
		color: #1D2541;
	}

	.backgroudmodel{
		position: absolute;
		top: 80rpx;
		width: 670rpx;
		height: 216rpx;
		background: #FFFFFF;
		box-shadow: 0rpx 14rpx 16rpx 0rpx rgba(43,102,253,0.07);
		border-radius: 14rpx 14rpx 14rpx 14rpx;
	}
	/* 自定义导航栏内容 start */
	.custom-nav {
		height: 100%;

		&__back {
			margin: auto 5rpx;
			font-size: 40rpx;
			margin-right: 10rpx;
			flex-basis: 5%;
			width: 100rpx;
			position: absolute;
		}
	}

	/* 自定义导航栏内容 end */

	/* 顶部背景图 start */
	.top-backgroup {
		height: 450rpx;
		z-index: -1;

		.backgroud-image {
			width: 100%;
			height: 450rpx;
			z-index: -1;
		}
	}

	/* 顶部背景图 end */


	/* 图标容器5 start */
	.icon5 {
		&__item {
			// width: 30%;
			background-color: #FFFFFF;
			border-radius: 10rpx;
			padding: 0rpx;
			margin: 0rpx;
			transform: scale(1);
			transition: transform 0.3s linear;
			transform-origin: center center;

			&--icon {
				width: 96rpx;
				height: 96rpx;
				border-radius: 50%;
				margin-bottom: 18rpx;
				position: relative;
				z-index: 1;
			}
		}
	}

	/* 用户头像 start */
	.logo-image {
		width: 152rpx;
		height: 152rpx;
		position: relative;
		overflow: hidden;
		border-radius: 50%;
	}

	.logo-pic {
		background-size: cover;
		background-repeat: no-repeat;
		// background-attachment:fixed;
		background-position: top;
		border: 8rpx solid rgba(255, 255, 255, 0.05);
		box-shadow: 0rpx 0rpx 80rpx 0rpx rgba(0, 0, 0, 0.15);
		border-radius: 50%;
		overflow: hidden;
		// background-color: #FFFFFF;
	}

	/* 页面阴影 start*/
	.wallpaper-shadow {
		border-radius: 15rpx;
		box-shadow: 0rpx 0rpx 50rpx 0rpx rgba(0, 0, 0, 0.07);
	}

	/* 页面阴影 end*/

	/* 图标容器15 start */
	.icon15 {
		&__item {
			width: 30%;
			background-color: #FFFFFF;
			border-radius: 10rpx;
			padding: 30rpx;
			margin: 20rpx 10rpx;
			transform: scale(1);
			transition: transform 0.3s linear;
			transform-origin: center center;

			&--icon {
				width: 100rpx;
				height: 100rpx;
				font-size: 60rpx;
				border-radius: 50%;
				margin-bottom: 18rpx;
				position: relative;
				z-index: 1;

				&::after {
					content: " ";
					position: absolute;
					z-index: -1;
					width: 100%;
					height: 100%;
					left: 0;
					bottom: 0;
					border-radius: inherit;
					opacity: 1;
					transform: scale(1, 1);
					background-size: 100% 100%;


				}
			}
		}
	}


	/* 图标容器12 start */
	.icon12 {
		&__item {
			width: 30%;
			background-color: #FFFFFF;
			border-radius: 10rpx;
			padding: 30rpx;
			margin: 20rpx 10rpx;
			transform: scale(1);
			transition: transform 0.3s linear;
			transform-origin: center center;

			&--icon {
				width: 15rpx;
				height: 15rpx;
				font-size: 50rpx;
				border-radius: 50%;
				margin-bottom: 38rpx;
				position: relative;
				z-index: 1;

				&::after {
					content: " ";
					position: absolute;
					z-index: -1;
					width: 100%;
					height: 100%;
					left: 0;
					bottom: 0;
					border-radius: inherit;
					opacity: 1;
					transform: scale(1, 1);
					background-size: 100% 100%;

				}
			}
		}
	}

	/* 图标容器1 start */
	.icon1 {
		&__item {
			// width: 30%;
			background-color: #FFFFFF;
			border-radius: 10rpx;
			padding: 30rpx;
			margin: 20rpx 10rpx;
			transform: scale(1);
			transition: transform 0.3s linear;
			transform-origin: center center;

			&--icon {
				width: 40rpx;
				height: 40rpx;
				font-size: 40rpx;
				border-radius: 50%;
				position: relative;
				z-index: 1;

				&::after {
					content: " ";
					position: absolute;
					z-index: -1;
					width: 100%;
					height: 100%;
					left: 0;
					bottom: 0;
					border-radius: inherit;
					opacity: 1;
					transform: scale(1, 1);
					background-size: 100% 100%;
					background-image: url(https://resource.tuniaokj.com/images/cool_bg_image/icon_bg.png);
				}
			}
		}
	}

	/* 图标容器1 end */


	.button-shake {
		animation: shake 4s infinite;
	}

	@keyframes shake {

		5%,
		50% {
			transform: scale(1);
		}

		10% {
			transform: scale(0.9);
		}

		15% {
			transform: scale(1.15);
		}

		20% {
			transform: scale(1.15) rotate(-5deg);
		}

		25% {
			transform: scale(1.15) rotate(5deg);
		}

		30% {
			transform: scale(1.15) rotate(-3deg);
		}

		35% {
			transform: scale(1.15) rotate(2deg);
		}

		40% {
			transform: scale(1.15) rotate(0);
		}
	}



	/* 背景波浪高度 */
	.button-number {
		width: 100%;
		height: 150rpx;
		border-radius: 15rpx;
		position: relative;
		z-index: 1;
	}

	/* 动态背景波浪*/
	@keyframes move_wave {
		0% {
			transform: translateX(0) translateZ(0) scaleY(1)
		}

		50% {
			transform: translateX(-25%) translateZ(0) scaleY(1)
		}

		100% {
			transform: translateX(-50%) translateZ(0) scaleY(1)
		}
	}

	.tnwave {
		overflow: hidden;
		position: absolute;
		left: 0;
		right: 0;
		bottom: 0;
		top: 0;
		margin: auto;
		z-index: -1;
		border-radius: 15rpx;
	}

	.waveWrapperInner {
		position: absolute;
		width: 100%;
		overflow: hidden;
		height: 100%;
	}

	.wave {
		position: absolute;
		left: 0;
		width: 200%;
		height: 100%;
		background-repeat: repeat no-repeat;
		background-position: 0 bottom;
		transform-origin: center bottom;
	}

	.bgTop {
		opacity: 0.1;
	}

	.waveTop {
		background-size: 50% 45px;
	}

	.waveAnimation .waveTop {
		animation: move_wave 4s linear infinite;
	}

	.bgMiddle {
		opacity: 0.2;
	}

	.waveMiddle {
		background-size: 50% 40px;
	}

	.waveAnimation .waveMiddle {
		animation: move_wave 3.5s linear infinite;
	}

	.bgBottom {
		opacity: 0.3;
	}

	.waveBottom {
		background-size: 50% 35px;
	}

	.waveAnimation .waveBottom {
		animation: move_wave 2s linear infinite;
	}
</style>